<?php
for($i=0;$i<10;$i++){
	echo floor($i/2);
	echo '<br />';
}

exit;

header ( 'Content-Type: text/html; charset=utf-8' );
/* mb_internal_encoding("UTF-8");
mb_regex_encoding("UTF-8"); */

/**
 * beimuaihui System
 * Copyright(c) 2011-2020 beimuaihui.
 * @license    http://www.gnu.org/licenses/gpl.html     This software Under GPL V3 License
 * beimuaihui@gmail.com
 * http://code.google.com/p/beimuaihui/
 * $Id: index.php 430 2011-12-15 08:11:42Z beimuaihui@gmail.com $
 */
//echo '<pre>';print_r($_POST);print_r($_FILES);exit;
error_reporting ( E_ALL );
@ini_set ( "memory_limit", "1024M" );
@ini_set ( "max_execution_time", "0" );
@ini_set ( "short_open_tag", "Off" );
@ini_set ( "magic_quotes_gpc", "Off" );
@ini_set ( "magic_quotes_runtime", "Off" );
@set_magic_quotes_runtime ( 0 );

@ini_set ( 'display_errors', 1 );
date_default_timezone_set ( 'Asia/Hong_Kong' );

session_name ( md5 ( $_SERVER ['HTTP_HOST'] ) );
session_start ();

include_once 'config/config.php';

$aIncludePath = array (BAOGG_ROOT );
$aIncludePath [] = BAOGG_ROOT . 'library/';
$aIncludePath [] = BAOGG_ROOT . 'models/';
set_include_path ( implode ( PATH_SEPARATOR, $aIncludePath ) );

require_once 'Zend/Loader/Autoloader.php'; ////Zend_Loader::registerAutoload();


Zend_Loader::loadFile ( 'smarty/Smarty.class.php' );
$autoloader = Zend_Loader_Autoloader::getInstance ();
$autoloader->pushAutoloader ( 'Smarty', 'smartyAutoload' );
$autoloader->setFallbackAutoloader ( true );

class TestCsdnUser extends Baogg_Db_Table {
	/**
	 * The default table name
	 */
	protected $_name;
	protected $_db;
	protected $_primary;
	
	function __construct() {
		$this->_name = 'test_csdn_user';
		
		$this->primary = $this->_primary = 'test_user_id';
		parent::__construct ();
	}

}

$file_name = "D:\\www\\test\\www.csdn.net.sql";
$TestCsdnUser = new TestCsdnUser ();
/* $content=file_get_contents($file_name);
$arr_content=explode("\n",$content);
$ret=array_pop($arr_content);
var_dump($ret);
 */
/* $i=0;

$handle = @fopen($file_name, "r");
if ($handle) {
	while( !feof($handle)) {
		$buffer = fgets($handle, 4096);
		//echo $buffer.'<br >';
		$arr=explode('#',$buffer);
		if(!trim(@$arr[0])){
			continue;
		}
		$insert=array('test_user_name'=>trim(@$arr[0]),'password'=>trim(@$arr[1]),'email'=>trim(@$arr[2]));
		if(!$TestCsdnUser->getList(array('test_user_name'=>trim(@$arr[0])),null,null,array('test_user_id'))){
			@$TestCsdnUser->_insert($insert);
		}
		
	}
	fclose($handle);
} */

$f = fopen ( $file_name, "r" );

while ( $buffer = fgets ( $f ) ) {
	if ($buffer === FALSE) {
		print ("FALSE\n") ;
		break;
	} else {
		$arr = explode ( '#', $buffer );
		if (! trim ( @$arr [0] )) {
			continue;
		}
		$insert = array ('test_user_name' => trim ( @$arr [0] ), 'password' => trim ( @$arr [1] ), 'email' => trim ( @$arr [2] ) );
		if (! $TestCsdnUser->getList ( array ('test_user_name' => trim ( @$arr [0] ) ), null, null, array ('test_user_id' ) )) {
			@$TestCsdnUser->_insert ( $insert );
		}
	}
}
fclose ( $f );
